package {{.PackageName}}.model

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;

import org.hibernate.validator.constraints.Length;

import com.neusoft.bizcore.web.jpa.model.AbstractModel;
import com.neusoft.bizcore.web.jpa.model.Comment;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

@Getter
@Setter
@ToString
@Entity
@org.hibernate.annotations.Table(appliesTo = "{{.TableName}}", comment = "{{.TableComment}}")
@Table(name = "{{.TableName}}")
public class {{.ClassName}} extends AbstractModel {

    private static final long serialVersionUID = 1L;
    {{range $i, $v := .Fields}}
    /** {{$v.TableFieldComment}} */
    {{$R1 := $v.NullAble}}{{$R2 := "false"}}{{if eq $R1 $R2}}@NotBlank(mesage="{{$v.TableFieldComment}}不能为空"){{end}}
    @Length(max = {{$v.Length}}, message = "{{$v.TableFieldComment}}不能超过{max}位")
    @Column(length= {{$v.Length}},nullable = {{$v.NullAble}})
    @Comment("{{$v.DataBaseType}}({{$v.Length}}) NOT NULL COMMENT {{$v.TableFieldComment}}")
    private {{$v.Type}} {{$v.FieldName}};
    {{end}}
}